package com.xiaoge.system.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.*;

import java.util.Date;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;


/**
 * <p>
 * 用户表
 * </p>
 *
 * @author xiaoge
 * @since 2021-02-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_user")
@ApiModel(value = "User对象", description = "用户表")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Excel(name = "用户名", width = 20)
    @ApiModelProperty(value = "用户名")
    private String username;

    @Excel(name = "昵称", width = 20)
    @ApiModelProperty(value = "昵称")
    private String nickname;

    @Excel(name = "性别", replace = {"男_0", "女_1", "保密_2"})
    @ApiModelProperty(value = "性别 0男 1女 2保密")
    private Integer sex;

    @Excel(name = "邮箱", width = 30)
    @ApiModelProperty(value = "邮箱")
    private String email;

    @Excel(name = "头像", width = 100)
    @ApiModelProperty(value = "头像")
    private String avatar;

    @Excel(name = "联系电话", width = 20)
    @ApiModelProperty(value = "联系电话")
    private String phoneNumber;

    @Excel(name = "状态", replace = {"锁定_0", "有效_1"})
    @ApiModelProperty(value = "状态 0锁定 1有效")
    private Integer status;

    @Excel(name = "创建时间", width = 30, format = "yyyy-MM-dd hh:mm:ss")
    @ApiModelProperty(value = "创建时间")
    // 插入时自动填充
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @Excel(name = "修改时间", width = 30, format = "yyyy-MM-dd hh:mm:ss")
    @ApiModelProperty(value = "修改时间")
    // 修改时自动填充
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date modifiedTime;


    @ApiModelProperty(value = "盐")
    private String salt;

    @Excel(name = "用户角色", width = 15, replace = {"超级管理员_0", "系统用户_1"})
    @ApiModelProperty(value = "0:超级管理员，1：系统用户")
    private Integer type;

    @Excel(name = "用户密码", width = 80)
    @ApiModelProperty(value = "密码")
    private String password;

    @Excel(name = "生日", format = "yyyy-MM-dd", width = 20)
    @ApiModelProperty(value = "生日")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birth;


    @ApiModelProperty(value = "部门id")
    private Long departmentId;

    @Excel(name = "部门名称",width = 30)
    @ApiModelProperty(value = "部门名称")
    //非数据库字段
    @TableField(exist = false)
    private String deptName;

}
